package com.diudiutechnology.www.yadiudiu.yadiudiu.mine.MyActivity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.diudiutechnology.www.yadiudiu.yadiudiu.mine.MyAdapter.ClassificationActivityAdapter;
import com.diudiutechnology.www.yadiudiu.util.view.SlideListView;
import com.diudiutechnology.www.yadiudiu.yadiudiu.model.BuyACarFragmentModel;
import com.diudiutechnology.www.yadiudiu.R;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/8/24.
 * 添加分类
 */

public class ClassificationActivity extends Activity implements View.OnClickListener {
    @Bind(R.id.retur)
    LinearLayout retur;

    @Bind(R.id.bottom_options)//添加分类
    LinearLayout bottom_options;

    Context context;
    @Bind(R.id.listview)
    SlideListView listview;

    private List<BuyACarFragmentModel> listModel;
    ClassificationActivityAdapter adapter;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_classification);
        ButterKnife.bind(this);
        context = this;
        initView();
    }

    private void initView() {
        retur.setOnClickListener(this);
        bottom_options.setOnClickListener(this);
        adapter=new ClassificationActivityAdapter(this);
        listview.setAdapter(adapter);
        initData();

    }
    private  void initData(){
        listModel=new ArrayList<>();
        BuyACarFragmentModel model=new BuyACarFragmentModel();
        model.setName("洁净干洗店");
        listModel.add(model);
        model=new BuyACarFragmentModel();
        model.setName("洁净干洗店");
        listModel.add(model);
        model=new BuyACarFragmentModel();
        model.setName("洁净干洗店");
        listModel.add(model);
        adapter.addItem(listModel);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.retur:
                finish();
                break;
            case R.id.bottom_options:
              startActivity(new Intent(context,ClassifyActivity.class));
                break;


        }
    }
}
